# -*- coding: utf-8 -*-

"""
@Datetime: 2019/5/25
@Author: Zhang Yafei
"""
from functools import wraps


class Eat(object):
    # 装饰器 Eta
    # :return
    def __init__(self, func):
        self.func = func

    def __call__(self, *args, **kwargs):
        print('i am eating')
        return self.func(*args, **kwargs)


@Eat
def wash():
    # 洗手
    # :return:
    print('i am washing')


wash()
print(wash.__class__)


class Eat(object):
    """
    装饰器 Eta
    :return
    """
    def __call__(self, func):
        @wraps(func)
        def eat(*args,**kwargs):
            print('i am eating')
            return func(*args,**kwargs)
        return eat


@Eat()
def wash():
    """
    洗手
    :return:
    """
    print('i am washing')


wash()
print(wash.__name__)
